class Solution {
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string,vector<string>> hash;
        for(auto& e : strs)
        {
            string tmp = e;
            sort(tmp.begin(), tmp.end()); // 排序后异位次的key值都相等了
            hash[tmp].push_back(e);
        }
 
        vector<vector<string>> ret;
        for(auto& [x, y] : hash) // 范围for得到两个值的用法
        {
            ret.push_back(y);
        }
        return ret;
    }
};